package com.lzy.cloud.shop.service.impl;

import com.lzy.cloud.shop.dto.ShopCategoryDto;
import com.lzy.cloud.shop.entity.ShopCategory;
import com.lzy.cloud.shop.mapper.ShopCategoryMapperExt;
import com.lzy.cloud.shop.service.ShopCategoryService;
import com.lzy.framework.core.utils.DozerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShopCategoryServiceImpl implements ShopCategoryService {

    @Autowired
    ShopCategoryMapperExt shopCategoryMapperExt;

    @Override
    public List<ShopCategoryDto> selectListByCategoryId(Long categoryId) {
        return shopCategoryMapperExt.selectListByCategoryId(categoryId);
    }

    @Override
    public List<ShopCategoryDto> selectListByShopId(Long shopId) {
        return shopCategoryMapperExt.selectListByShopId(shopId);
    }

    @Override
    public Boolean add(ShopCategoryDto shopCategoryDto) {
        return shopCategoryMapperExt.insertSelective(DozerUtils.map(shopCategoryDto,ShopCategory.class))>0;
    }
}
